import com.powerfl.frm.taf.*;

final public function stringAddTail( $original:String, $add:String ):String{
	return $original + $add;
}
final public function stringAddHead( $original:String, $add:String ):String{
	return $add + $original;
}
final public function stringTailGet( $original:String, $count:int ):String{
	return $original.substr( -$count );
}
final public function stringHeadGet( $original:String, $count:int ):String{
	return $original.substr( 0, $count );
}

static public function removeSpace( $value:String ):String{
	return $value.replace( rxRemoveSpace, '' );
}
static public function trim( $value:String ):String{
	var i:int;
	i = 0;
	while( $value.charAt( i ) === ' ' || $value.charAt( i ) === '\n' || $value.charAt( i ) === '\r' || $value.charAt( i ) === '\f' || $value.charAt( i ) === '\t' ){
		++i;
	}
	if( i ){
		$value = $value.substr( i );
	}
	i = $value.length - 1;
	while( $value.charAt( i ) === ' ' || $value.charAt( i ) === '\n' || $value.charAt( i ) === '\r' || $value.charAt( i ) === '\f' || $value.charAt( i ) === '\t' ){
		--i;
	}
	if( i < $value.length - 1 ){
		$value = $value.substr( 0, i + 1 );
	}
	return $value;
}
static public function formatInt( $val:int ):String{
	return $val.toString().replace( rxNumberComma, ',' );
}
static public function BSsep( $value:String ):Array{
	var temp:Array, i:int;
	if( $value.search( rxNSEP ) > -1 ){
		temp = $value.split( rxNSEP );	
	}else{
		temp = $value.split( rxRSEP );
	}
	for( i = temp.length - 1 ; i > -1 ; --i ){
		temp[i] = trim( temp[i] );
		if( temp[i] ){}else{
			temp.splice( i, 1 );
		}
	}
	return temp;
}